package com.ambimmort.shj.action.device;

import com.ambimmort.shj.service.device.DeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by zyt on 2015/7/30.
 */
@Controller("/action/device/edit.do")
public class Edit {
        @Autowired
        private DeviceService deviceService;
        @RequestMapping("/action/device/edit.do")
        @ResponseBody
        public String action_device(
                HttpServletRequest request, @RequestParam("id") String id, @RequestParam("Dev_Name") String Dev_Name, @RequestParam("Dev_IP") String Dev_IP, @RequestParam("Probe_Type") String Probe_Type, @RequestParam("DeploySiteName") String DeploySiteName, @RequestParam("IDC_HouseID") String IDC_HouseID, @RequestParam("description") String description, @RequestParam("result") String result) {
            try {
                deviceService.editDevice(id, Dev_Name, Dev_IP, Probe_Type, DeploySiteName, IDC_HouseID, description, result);
                return "{\"result\":\"true\"}";
            } catch (Throwable throwable) {
                throwable.printStackTrace();
                return "{\"result\":\"false\"}";
            }

        }


}
